#include "../../../lib/std.mi"

Global Text txt;
Global ToggleButton tgbutton;
Global CfgGroup cgroup;

System.onScriptLoaded() {
  cgroup = getScriptGroup();
  txt = cgroup.getObject("cfg.txt");
  tgbutton = cgroup.getObject("cfg.toggle");
}

tgbutton.onToggle(int on) {
  cgroup.cfgSetInt(on);
}

cgroup.onCfgChanged() {
  txt.setText(cfgGetName());
  tgbutton.setActivated(cfgGetInt());
}
